<?php
	$css_list[0]['url'][] = './tpl/css/book.css';
	$css_list[0]['url'][] = './tpl/css/search.css';
	$js_list[0] = './public/js/jquery.masonry.js';
	$js_list[1] = './public/js/city.js';
?>
<!--{template inc/header_w}-->
<div class="main_body">
    <!--{template inc/search_tabs}-->
    <div class="wf_filter">
     <!--   <a href="/search.php?word={$keyword}&action={ACTION_NAME}&order=sharenum" class="a1{if $orderkey=='sharenum'} current{/if}" title="按分享数从高到低">{if $orderkey=='sharenum'}分享数从高到低{else}分享数{/if}</a> -->
        <a href="/search.php?word={$keyword}&action={ACTION_NAME}&order=commentnum" class="a1{if $orderkey=='commentnum'} current{/if}" title="按赞数从高到低">{if $orderkey=='commentnum'}赞数从高到低{else}评论数{/if}</a> 
        {if ACTION_NAME == 'anli'}
        <a id="areatigger" href="#" class="a1">{if !empty($areaname)}{$areaname}{else}地区{/if}</a>
        <div id="area" class="wf_filter_area">
            <p>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=113&areaname=合肥">合肥</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=133&areaname=福州">福州</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=147&areaname=兰州">兰州</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=161&areaname=广州">广州</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=188&areaname=南宁">南宁</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=199&areaname=贵阳">贵阳</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=209&areaname=海口">海口</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=216&areaname=石家庄">石家庄</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=231&areaname=哈尔滨">哈尔滨</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=245&areaname=郑州">郑州</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=264&areaname=香港">香港</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=267&areaname=武汉">武汉</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=284&areaname=长沙">长沙</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=298&areaname=南京">南京</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=324&areaname=南昌">南昌</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=337&areaname=长春">长春</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=348&areaname=沈阳">沈阳</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=363&areaname=呼和浩特">呼和浩特</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=375&areaname=银川">银川</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=379&areaname=西宁">西宁</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=388&areaname=济南">济南</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=421&areaname=西安">西安</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=432&areaname=成都">成都</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=496&areaname=乌鲁木齐">乌鲁木齐</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=514&areaname=拉萨">拉萨</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=521&areaname=昆明">昆明</a> <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=540&areaname=杭州">杭州</a>
            </p>
            <p>

                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=1&areaname=北京">北京</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=2&areaname=上海">上海</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=3&areaname=重庆">重庆</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=4&areaname=安徽">安徽</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=5&areaname=福建">福建</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=6&areaname=甘肃">甘肃</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=7&areaname=广东">广东</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=8&areaname=广西">广西</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=9&areaname=贵州">贵州</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=10&areaname=海南">海南</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=11&areaname=河北">河北</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=12&areaname=黑龙江">黑龙江</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=13&areaname=河南">河南</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=14&areaname=香港">香港</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=15&areaname=湖北">湖北</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=16&areaname=湖南">湖南</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=17&areaname=江苏">江苏</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=18&areaname=江西">江西</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=19&areaname=吉林">吉林</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=20&areaname=辽宁">辽宁</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=21&areaname=澳门">澳门</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=22&areaname=内蒙古">内蒙古</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=23&areaname=宁夏">宁夏</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=24&areaname=青海">青海</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=25&areaname=山东">山东</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=26&areaname=山西">山西</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=27&areaname=陕西">陕西</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=28&areaname=四川">四川</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=29&areaname=台湾">台湾</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=30&areaname=天津">天津</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=31&areaname=新疆">新疆</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=32&areaname=西藏">西藏</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=33&areaname=云南">云南</a>
                <a href="/search.php?word={$keyword}&action=anli&order={$orderkey}&provinceid=34&areaname=浙江">浙江</a>
            </p>
            <div>
				<select id="province" name="province" class="g_ipt1">
				</select>
				&nbsp;&nbsp;
				<select id="city" name="city" class="g_ipt1">
				</select>
				<input type="button" onclick="addcity()" value="添加" class="g_btn2">
				<input type="button" onclick="docitysea()" value="确定" class="g_btn2">
                <input type="button" onclick="closearea()" value="× 关闭" class="g_btn2">
           </div>
           <p id="cities" class="i_cities">
                {if !empty($cityidarr)}
                {loop $cityidarr $k $id}
                <a id="city_{$id}" href="javascript:rmcity({$id});">{$areanamearr[$k]}<span>×</span></a>
                {/loop}
                {/if}
           </p>
        </div>
        <div class="i_sele" id="selePrice">
            <a href="#" class="a1{if $orderkey=='pricedown' || $orderkey=='priceup'} current{/if}"><span{if $orderkey=='pricedown' || $orderkey=='priceup'} style="color:#f40;"{/if}>{if $orderkey=='priceup'}价格从低到高{elseif $orderkey=='pricedown'}价格从高到低{else}价格{/if}</span><em class="ui"></em></a>
            <div class="j_menu" id="selePriceMenu">
                <ul>
                    <li><a href="/search.php?action=anli&word={$keyword}&order=priceup">价格从低到高</a></li>
                    <li><a href="/search.php?action=anli&word={$keyword}&order=pricedown">价格从高到低</a></li>
                </ul>
            </div>
        </div>
        <form action="/search.php">
            <div class="i_price">
                <input type="text" name="minprice" class="j_ipt" size="4" value="{$minprice}" /> - <input type="text" name="maxprice" class="j_ipt" size="4" value="{$maxprice}" />
                <input type="submit" class="j_btn" value="确认" />
                <input type="hidden" name="action" value="anli"/>
                <input type="hidden" name="word" value="{$keyword}"/>
                <input type="hidden" name="order" value="{$orderkey}"/>
            </div>
        </form>
        {/if}
    </div>
    
    <div class="wf_list" id="wfContainer">
        <!--{loop $articles $item}-->
        <div class="item">
            <a href="{u article/show id=$item['id']}" target="_blank" class="a1"><span class="g_radius"><span>评论({$item['comment_count']})</span></span><img src="{$item[img]}" class="wf_img" width="{$item[width]}" height="{$item[height]}" /></a>
            <div class="i_info">
                <a href="{u article/show id=$item['id']}">{$item[title]}</a>
            </div>
            
            {if $item['anli'] == 1}
            <div class="i_time">
                店铺：{$item['shop_name']}&nbsp;<img border="0" style="vertical-align:middle;" src="/public/v1/img/bv.png"/><br/>
                时间：<?php echo date('Y-m-d', $item['create_time']); ?><br/>地区：<a href="/article.php?action=index&{if !$uid}cate={$cate_id}{else}uid={$uid}{/if}&order={$orderkey}&cityid={$item['city']}&areaname={$item['city_show']}">{$item['province_show']}{$item['city_show']}</a>
                <div class="j_price">
                    <label>促销价</label><b class="b1">￥{$item['price']}</b>
                </div>
                {if $item['price2'] > 0}
                <div class="j_price">
                    <label>价格</label><b class="b2">￥{$item['price2']}</b>
                </div>
                {/if}
            </div>
            {else}
            <div class="i_time">
                作者：<a href="{if empty($item['uid'])}/{else}/u.php?action=index&uid={$item['uid']}{/if}">{if empty($item['uid'])}火锅阁{else}{$name_list[$item['uid']]['user_name']}{/if}</a>
                {if $name_list[$item['uid']]['realname_shop']}
                <img border="0" style="vertical-align:middle;" src="/public/v1/img/bv.png"/>
                {elseif $name_list[$item['uid']]['realname_person']}
                <img border="0" style="vertical-align:middle;" src="/public/v1/img/rv.png"/>
                {/if}<br/>
                时间：<?php echo date('Y-m-d', $item['create_time']); ?>
            </div>
            {/if}
        </div>
        <!--{/loop}-->
    </div>

    {if empty($articles)}
    <div class="no_found">
        <div class="i_center"><img src="/public/v1/img/no_found.gif"><p>未找到与<span>"{$keyword}"</span>相关的信息</p></div>
    </div>
    {/if}

    
</div>


<script>
$('#wfContainer').masonry({
    itemSelector: '.item',
    gutterWidth: 12
});
$(function(){
    

    $(window).resize(function() {
        resize_masonry();
    });

    resize_masonry();
    
    
});

function resize_masonry(){
    var max_width=$('#wfContainer').width();
    var col_num=max_width>1440?7:5;
    var min_gutter=12;
    var item_width=Math.floor((max_width-min_gutter*(col_num-1))/col_num)-2;
    $('#wfContainer .item').css('width',item_width);
    $('#wfContainer .item .wf_img').each(function(){
        var b=parseInt($(this).attr('width'))/parseInt($(this).attr('height'));
        var item_height=Math.floor(item_width/b);
        $(this).attr('width',item_width);
        $(this).attr('height',item_height);
    });
    $('#wfContainer').masonry( 'reload' );
}


function appendShareItem(result,index) {
	html = '<div>' + result + '</div>';
    html = $(html).find('.item');
    $('#wfContainer').append(html);
    resize_masonry();
}

$("#areatigger").click(function(){
    $('#area').show();
});

function closearea() {
    $('#area').hide();
}

var cityids = [{if !empty($cityidarr)}<?php echo implode(',',$cityidarr); ?>{/if}], citynames = [{if !empty($cityidarr) && !empty($areanamearr)}'<?php echo implode('\',\'',$areanamearr); ?>'{/if}];
function addcity() {
    var cityid = $('#city').val();
    for(var i = 0; i < cityids.length; i++) {
        if(cityid == cityids[i]) {
            return;
        }
    }
    var name = $('#city').find("option:selected").text();
    cityids.push(cityid);
    citynames.push(name);
    $('#cities').append('<a id="city_'+cityid+'" href="javascript:rmcity('+cityid+');">'+name+'<span>×</span></a>');
}

function rmcity(cityid) {
    for(var i = 0; i < cityids.length; i++) {
        if(cityid == cityids[i]) {
            break;
        }
    }
    cityids.splice(i, 1);
    citynames.splice(i, 1);
    $('#city_'+cityid).remove();
}

function docitysea() {
    $('#area').hide();
    var url = '/search.php?word={$keyword}&action=anli&order={$orderkey}&cityid=';
    url += cityids.join(',');
    url += '&areaname=' + citynames.join(',');
    location.href = url;
}

jQuery(function($){
	$.Bind_City("#province","#city","{$_FANWE['user']['reside_province']}","{$_FANWE['user']['reside_city']}");
});
</script>


<!--{template inc/footer}-->
